﻿using Nutshell.Components.Models;
using Nutshell.Data;
using Nutshell.Distributing;
using Nutshell.Messaging.Models;
using Nutshell.NetMQ;
using Nutshell.NetMQ.Models;

namespace Nutshell.DHVCS.Business
{
        public class GlobalManager : NotifyPropertyChangedObject
        {
                #region 构造函数

                private GlobalManager()
                {
                }

                #endregion

                #region 单例

                /// <summary>
                ///         单例
                /// </summary>
                public static readonly GlobalManager Instance = new GlobalManager();

                #endregion

                public SendSite<LogMessageModel> LogSite { get; private set; }

                public SendSite<StringValueMessageModel> SynthesizeSite { get; private set; }


                public void Start()
                {
                        StartLogSite();
                        StartSynthesizeSite();

                }

                private void StartLogSite()
                {
                        LogSite = NetMQSiteHelper.CreateSendSite<LogMessageModel>(@"配置\Log");
                        LogSite.Start();
                }

                private void StartSynthesizeSite()
                {
                        SynthesizeSite = NetMQSiteHelper.CreateSendSite<StringValueMessageModel>(@"配置\Log");
                        SynthesizeSite.Start();
                }


                public void Stop()
                {
                        SynthesizeSite.Stop();
                        LogSite.Stop();
                }
        }
}